package week3.day20;

import java.io.File;
import java.util.Arrays;

/**
 * @Author fengzihao
 * @Date 2024-05-04 14:21
 */
public class PracticeListFiles {
    public static void main(String[] args) {
        File file = new File("F:\\TestFileFilter");
        File[] files = file.listFiles(ListFiles::accept);
        System.out.println(Arrays.toString(files));
    }
}
class ListFiles{
    public static boolean accept(File pathname){
        boolean result = pathname.getName().contains("a");
        result = !result ?result:pathname.getName().endsWith(".txt");
        result = !result ?result:pathname.getName().startsWith("a");
        return result;
    }
}
